﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.TD
{
	public class Mline : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public Mline(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(Mline obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~Mline()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_Mline(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public Mline() : this(TD_DbPINVOKE.new_Mline(), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public const int kTop = 0;

		public const int kZero = 1;

		public const int kBottom = 2;

		public const int kOpen = 0;

		public const int kClosed = 1;

		public const int kMerged = 2;

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
